﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Peninsula.DataAccess.POCO
{
    [Table("Permission")]
    public partial class Permission : BaseEntity
    {
        public Permission()
        {
            Roles = new HashSet<Role>();
            Chindren = new HashSet<Permission>();
        }

        [Required]
        [StringLength(50)]
        [DisplayName("权限名称")]
        public string PermissionName { get; set; }

        [StringLength(200)]
        [DisplayName("权限描述")]
        public string Description { get; set; }

        [DisplayName("作为菜单")]
        public bool IsMenu { get; set; }

        [StringLength(100)]
        public string Action { get; set; }

        [StringLength(100)]
        public string Controller { get; set; }

        [StringLength(200)]
        public string Url { get; set; }

        [StringLength(200)]
        public string CssClass { get; set; }

        [DisplayName("菜单顺序")]
        public int Order { get; set; }

        [DisplayName("父级权限")]
        public string Parent_Id { get; set; }

        [ForeignKey("Parent_Id")]
        [DisplayName("父级权限")]
        public Permission Parent { get; set; }

        [ForeignKey("Parent_Id")]
        public virtual ICollection<Permission> Chindren { get; set; }

        public virtual ICollection<Role> Roles { get; set; }
    }
}
